package ch1.exe;

import java.util.Scanner;

public class TestTourist {
	public static void main(String[] args) {
		// 创建游客对象

		Scanner input = new Scanner(System.in);

		while (true) {
			Tourist vistors = new Tourist();
			vistors.fare = 20;// 设置票价为20元
			System.out.print("请输入游客姓名：");
			String x = input.next();
			if (x.equals("n"))
				break;

			vistors.name = x;
			System.out.print("请输入游客年龄：");
			vistors.age = input.nextInt();
			vistors.payTicket();// 调用方法，输出实际的票价

		}
		System.out.println("程序结束！");
	}
}
